API Documentation
ListBox.h
1 // ListBox.h
3 //
5 
6 namespace nkWinUi
7 {
11  class ListBox : public Component
12  {
13  public :
14 
18  class Item
19  {
20  public :
21 
25  Item () ;
29  ~Item () ;
30 
31  // Getters
35  ListBox* getParentList () const ;
43  void* getAttachedData () const ;
44 
45  // Setters
51  void setParentList (ListBox* parent) ;
57  void setLabel (const nkMemory::StringView& label) ;
65  void setAttachedData (void* data) ;
66  } ;
67 
68  public :
69 
77  ListBox (MainSystem* parentSystem) ;
81  ~ListBox () ;
82 
83  // Getters
88  Item* getItemFromLabel (const nkMemory::StringView& label) const ;
93  Item* getItemFromData (void* data) const ;
98  Item* getItemFromIndex (unsigned int index) const ;
102  virtual Item* getCurrentSelection () const ;
106  virtual int getCurrentSelectionIndex () const ;
110  std::function<void (ListBox*)> getSelectionCallback () const ;
114  unsigned int getItemCount () const ;
115 
116  // Setters
122  void setSelectionCallback (std::function<void (ListBox*)> value) ;
123 
133  virtual Item* insertItem (const nkMemory::StringView& text, void* data) ;
139  virtual void* deleteItem (const nkMemory::StringView& name) ;
146  virtual void changeItemLabel (const nkMemory::StringView& oldText, const nkMemory::StringView& newText) ;
155  void changeItemData (const nkMemory::StringView& text, void* newData) ;
162  virtual bool setSelected (const nkMemory::StringView& text) ;
169  virtual bool setSelectedIndex (unsigned int index) ;
176  bool setSelectedData (void* data) ;
180  virtual void clearItems () ;
181 
185  virtual void exportIntrospection (nkExport::Node* rootNode) override ;
189  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
190  } ;
191 }
nkWinUi::ListBox::Item::~Item
~Item()
nkWinUi::ListBox::setSelectionCallback
void setSelectionCallback(std::function< void(ListBox *)> value)
nkWinUi::ListBox::Item::setAttachedData
void setAttachedData(void *data)
nkWinUi::ListBox::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemCount
unsigned int getItemCount() const
nkWinUi::ListBox::getCurrentSelection
virtual Item * getCurrentSelection() const
nkWinUi::ListBox
A graphical list box.
Definition: ListBox.h:12
nkWinUi::ListBox::getItemFromIndex
Item * getItemFromIndex(unsigned int index) const
nkWinUi::ListBox::deleteItem
virtual void * deleteItem(const nkMemory::StringView &name)
nkWinUi::ListBox::Item::Item
Item()
nkWinUi::ListBox::setSelectedIndex
virtual bool setSelectedIndex(unsigned int index)
nkWinUi::ListBox::setSelectedData
bool setSelectedData(void *data)
nkWinUi::ListBox::Item
Definition: ListBox.h:19
nkWinUi::ListBox::exportIntrospection
virtual void exportIntrospection(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemFromLabel
Item * getItemFromLabel(const nkMemory::StringView &label) const
nkWinUi::ListBox::changeItemLabel
virtual void changeItemLabel(const nkMemory::StringView &oldText, const nkMemory::StringView &newText)
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::ListBox::setSelected
virtual bool setSelected(const nkMemory::StringView &text)
nkWinUi::ListBox::getSelectionCallback
std::function< void(ListBox *)> getSelectionCallback() const
nkWinUi::ListBox::Item::getParentList
ListBox * getParentList() const
nkWinUi::ListBox::Item::setLabel
void setLabel(const nkMemory::StringView &label)
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkWinUi::MainSystem
The main system of the component.
Definition: MainSystem.h:18
nkWinUi::ListBox::insertItem
virtual Item * insertItem(const nkMemory::StringView &text, void *data)
nkWinUi::ListBox::~ListBox
~ListBox()
nkWinUi::ListBox::Item::getLabel
nkMemory::StringView getLabel() const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkWinUi::ListBox::clearItems
virtual void clearItems()
nkWinUi::ListBox::getCurrentSelectionIndex
virtual int getCurrentSelectionIndex() const
nkWinUi::ListBox::Item::setParentList
void setParentList(ListBox *parent)
nkWinUi::ListBox::Item::getAttachedData
void * getAttachedData() const
nkWinUi::ListBox::changeItemData
void changeItemData(const nkMemory::StringView &text, void *newData)
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkWinUi::ListBox::getItemFromData
Item * getItemFromData(void *data) const
nkWinUi::ListBox::ListBox
ListBox(MainSystem *parentSystem)